package com.atguigu.edu.realtime.publisher.mapping;

import com.atguigu.edu.realtime.publisher.bean.TradeCt;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CourseTradeCountMapper {
    @Select("  select subject_name name, sum(order_uu_count) uCt, sum(order_count) orderCt, sum(final_amount) orderAmount\n" +
            "  from dws_trade_subject_chapter_course_province_source_order_window\n" +
            "  where toYYYYMMDD(stt) = #{date}\n" +
            "  group by subject_name ")
   List<TradeCt> selectSubjectOrderCnt(Integer date);

    @Select("  select course_name name, sum(order_uu_count) uCt, sum(order_count) orderCt, sum(final_amount) orderAmount\n" +
            "  from dws_trade_subject_chapter_course_province_source_order_window\n" +
            "  where toYYYYMMDD(stt) = #{date}\n" +
            "  group by course_name ")
    List<TradeCt> selectCourseOrderCnt(Integer date);

    @Select("  select '编程技术' name, sum(order_uu_count) uCt, sum(order_count) orderCt, sum(final_amount) orderAmount\n" +
            "  from dws_trade_subject_chapter_course_province_source_order_window\n" +
            "  where toYYYYMMDD(stt) = #{date}")
    List<TradeCt> selectCategoryOrderCnt(Integer date);
}
